<!--
 * @Author: duan
 * @Description:  double-twelve
 * @Version: 1.0.0
 * @Time: 2020/11/16
-->
<template>
  <div class="goods-details">
    <!--banner-->
    <!--商品详情-->
    <img :src="memberInfo.equityDescImg" alt="" class="banner-img">

    <div class="goods-info">
      <div class="content">
        <div class="price">
          <div class="sale-price">¥{{ memberInfo.salePrice }}</div>
          <div class="market-price">¥{{ memberInfo.marketPrice }}</div>
        </div>
        <div class="name" v-show="memberInfo.equityName">{{ memberInfo.equityName }}</div>
      </div>
    </div>

    <!--商品详情-->
    <div class="details blank" ref="goodsDetail">
      <div class="content-details">
        <div class="title">权益描述</div>
        <div class="product-desc" v-html="memberInfo.description"></div>
      </div>
      <div class="title"></div>
    </div>

    <!--底部抢购-->
    <div class="footer">
      <div class="submit-content">
        <div class="pay-amount">¥ {{ memberInfo.salePrice }}</div>
        <div class="submit" @click="goBuy">开通权益</div>
      </div>
    </div>

    <!--返回顶部-->
    <BackToTop/>
  </div>
</template>

<script>
import BackToTop from '@/components/BackToTop'

export default {
  components: { BackToTop },
  data () {
    return {
      // 商品描述和详情
      memberInfo: {}
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created () {
    this.getMemberInfo() // 获取商品详情
  },

  // 方法
  methods: {
    // 1丶获取商品详情===================================
    getMemberInfo () {
      const params = {
        equityNo: this.$route.query.equityNo
      }
      this.$HttpPost(this.$api.equityDetail, params).then((res) => {
        if (res.code === '000') {
          this.memberInfo = res.content
        }else{
          this.$toast(res.desc, 'middle')
          this.memberInfo={}
        }
      })
    },
    // 2丶购买下单按钮跳转操作===================================
    goBuy () {
      if (!this.memberInfo.equityNo) {
        return Toast('商品不存在')
      }
      this.$router.push({
        path: '/member/orderConfirm',
        query: {
          equityNo: this.memberInfo.equityNo
        }
      })
    }

  }
}
</script>
<style scoped lang='scss'>

.goods-details {
  background-color: #F4F5F7;
  min-height: 100%;
  padding-bottom: 150px;
  img{
    display: block !important;
  }
  .banner-img {
    width: 100%;
    height: 420px;
    background-color: #FFFFFF;
  }

  //价格
  .goods-info {
    width: 100%;
    box-sizing: border-box;
    margin-top: 28px;
    padding: 0 14px;

    .content {
      display: flex;
      justify-content: start;
      align-items: flex-start;
      width: 100%;
      box-sizing: border-box;
      padding: 20px 0 20px 30px;
      background-color: #FFFFFF;
      border-radius: 14px;

      .price {
        flex-direction: column;

        .sale-price {
          font-size: 40px;
          font-family: PingFangSC, PingFangSC-Semibold;
          font-weight: 600;
          text-align: left;
          color: #d93939;
        }

        .market-price {
          margin-top: 10px;
          font-size: 26px;
          font-family: PingFangSC, PingFangSC-Light;
          font-weight: 300;
          text-decoration: line-through;
          text-align: left;
          color: #989898;
        }
      }

      .name {
        margin-left: 35px;
        margin-top: 5px;
        padding: 5px 10px;
        background: #fdd413;
        font-size: 20px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: center;
        color: #000000;
      }
    }
  }

  .goods-desc {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 32px 23px 22px 23px;
    box-sizing: border-box;
    border-radius: 14px;
    background-color: #ffffff;

    .name {
      align-self: start;
      font-size: 36px;
      font-family: PingFang, PingFang-SC;
      font-weight: 600;
      color: #000000;
      text-align: left;
    }

    .price {
      align-self: flex-end;

      .sale-price {
        font-size: 43px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        color: #d93939;
      }

      .old-price {
        margin-left: 15px;
        font-family: PingFangSC, PingFangSC-Light;
        font-weight: 300;
        color: #989898;
        text-decoration: line-through;
      }
    }

    .start {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 25px;
      font-family: PingFang, PingFang-SC;
      color: #000000;

      .van-count-down {
        margin-left: 5px;
        font-size: 12px;
        color: #d93939;
      }
    }
  }

  /*购买数量*/
  .blank {
    width: 100%;
    box-sizing: border-box;
    padding: 0 14px;
    margin-top: 26px;

    .content {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #ffffff;
      border-radius: 14px;
      box-sizing: border-box;
      padding: 30px 25px;

      .value {
        font-size: 29px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        color: #3e3e3e;
        letter-spacing: 1px;
      }
    }

    &.details {
      margin-top: 20px;
      padding-bottom: 50px;

      .content-details {
        display: flex;
        justify-content: start;
        align-items: start;
        flex-direction: column;
        width: 100%;
        min-height: 500px;
        background-color: #ffffff;
        border-radius: 14px;
        box-sizing: border-box;
        padding: 30px 0;
        box-sizing: border-box;
        overflow: hidden;

        .title {
          position: relative;
          margin-left: 40px;
          margin-top: 19px;
          font-size: 29px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          color: #3e3e3e;
          text-align: left;
          line-height: 41px;
          letter-spacing: 1px;

          &::after {
            content: '';
            position: absolute;
            left: -20px;
            top: 10px;
            display: block;
            width: 5px;
            height: 23px;
            background: #000000;
          }
        }

        .product-desc {
          width: 100%;
        }
      }

    }
  }

  /*底部立即抢购*/
  .footer {
    position: fixed;
    bottom: 77px;
    left: 0;
    width: 100%;
    height: 90px;

    .submit-content {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 690px;
      height: 90px;
      margin: 0 auto;
      border-radius: 45px;
      overflow: hidden;

      .pay-amount {
        width: 50%;
        height: 90px;
        background: linear-gradient(92deg, #fcdfdb 2%, #eda897 98%);
        font-size: 36px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 500;
        text-align: center;
        color: #96012b;
        line-height: 90px;
      }

      .submit {
        width: 50%;
        color: #ffffff;
        font-size: 30px;
        font-weight: 500;
        text-align: center;
        background: #B0071E;
        color: #ffffff;
        line-height: 90px;
      }

    }

  }

}

/*返回头部*/
.go-top {
  position: fixed;
  right: 30px;
  bottom: 150px;
  width: 62px;
  height: 62px;
  z-index: 99;
}
</style>
